package com.emergency.db.dao.item;

import com.emergency.db.domain.item.ItemDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


public interface ItemDetailDao extends JpaRepository<ItemDetail, Long>, JpaSpecificationExecutor<ItemDetail> {
    @Modifying
    @Query(value = "delete FROM bas_item_detail WHERE item_id = ? ", nativeQuery = true)
    void deleteByItem(Long id);

    @Query("select ide from ItemDetail ide where item.id=:id ")
    ItemDetail findByItem(@Param("id") Long id);
}
